package edu.cmu.cs.stage3.alice.authoringtool.datatransfer;

/**
 * @author Jason Pratt
 */
public class QuestionPrototypeReferenceTransferable extends ElementPrototypeReferenceTransferable {

        //LOB version using 'mimeType' to create 'java.awt.datatransfer.DataFlavor' produce error in Java 5, changed to 'Class'
	// public final static java.awt.datatransfer.DataFlavor questionPrototypeReferenceFlavor = new java.awt.datatransfer.DataFlavor( java.awt.datatransfer.DataFlavor.javaJVMLocalObjectMimeType + "; class=edu.cmu.cs.stage3.alice.authoringtool.util.QuestionPrototype", "questionPrototypeReferenceFlavor" );
	public final static java.awt.datatransfer.DataFlavor questionPrototypeReferenceFlavor
               = new java.awt.datatransfer.DataFlavor(edu.cmu.cs.stage3.alice.authoringtool.util.QuestionPrototype.class, "questionPrototypeReferenceFlavor" );

	protected edu.cmu.cs.stage3.alice.authoringtool.util.QuestionPrototype questionPrototype;

	public QuestionPrototypeReferenceTransferable( edu.cmu.cs.stage3.alice.authoringtool.util.QuestionPrototype questionPrototype ) {
		super( questionPrototype );
		this.questionPrototype = questionPrototype;

		flavors = new java.awt.datatransfer.DataFlavor[3];
		flavors[0] = questionPrototypeReferenceFlavor;
		flavors[1] = ElementPrototypeReferenceTransferable.elementPrototypeReferenceFlavor;
		flavors[2] = java.awt.datatransfer.DataFlavor.stringFlavor;
	}

	//Rem @Override
	public Object getTransferData( java.awt.datatransfer.DataFlavor flavor ) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException {
		if( flavor.equals( questionPrototypeReferenceFlavor ) ) {
			return questionPrototype;
		} else if( flavor.equals( ElementPrototypeReferenceTransferable.elementPrototypeReferenceFlavor ) ) {
			return questionPrototype;
		} else if( flavor.equals( java.awt.datatransfer.DataFlavor.stringFlavor ) ) {
			return questionPrototype.toString();
		} else {
			throw new java.awt.datatransfer.UnsupportedFlavorException( flavor );
		}
	}
}
